package com.ruoyi.project.tickets.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.project.tickets.domain.vo.OutStockDetailsVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.tickets.mapper.OutStockDetailsMapper;
import com.ruoyi.project.tickets.domain.OutStockDetails;
import com.ruoyi.project.tickets.service.IOutStockDetailsService;

/**
 * 出库详情Service业务层处理
 * 
 * @author 孙山伟
 * @date 2023-07-01
 */
@Service
public class OutStockDetailsServiceImpl implements IOutStockDetailsService 
{
    @Autowired
    private OutStockDetailsMapper outStockDetailsMapper;

    /**
     * 查询出库详情
     * 
     * @param updateTime 出库详情ID
     * @return 出库详情
     */
    @Override
    public OutStockDetails selectOutStockDetailsById(Long updateTime)
    {
        return outStockDetailsMapper.selectOutStockDetailsById(updateTime);
    }

    /**
     * 查询出库详情列表
     * 
     * @param outStockDetails 出库详情
     * @return 出库详情
     */
    @Override
    public List<OutStockDetails> selectOutStockDetailsList(OutStockDetails outStockDetails)
    {
        return outStockDetailsMapper.selectOutStockDetailsList(outStockDetails);
    }

    /**
     * 新增出库详情
     * 
     * @param outStockDetails 出库详情
     * @return 结果
     */
    @Override
    public int insertOutStockDetails(OutStockDetails outStockDetails)
    {
        outStockDetails.setCreateTime(DateUtils.getNowDate());
        return outStockDetailsMapper.insertOutStockDetails(outStockDetails);
    }

    /**
     * 修改出库详情
     * 
     * @param outStockDetails 出库详情
     * @return 结果
     */
    @Override
    public int updateOutStockDetails(OutStockDetails outStockDetails)
    {
        outStockDetails.setUpdateTime(DateUtils.getNowDate());
        return outStockDetailsMapper.updateOutStockDetails(outStockDetails);
    }

    /**
     * 批量删除出库详情
     * 
     * @param updateTimes 需要删除的出库详情ID
     * @return 结果
     */
    @Override
    public int deleteOutStockDetailsByIds(Long[] updateTimes)
    {
        return outStockDetailsMapper.deleteOutStockDetailsByIds(updateTimes);
    }

    /**
     * 删除出库详情信息
     * 
     * @param updateTime 出库详情ID
     * @return 结果
     */
    @Override
    public int deleteOutStockDetailsById(Long updateTime)
    {
        return outStockDetailsMapper.deleteOutStockDetailsById(updateTime);
    }

    @Override
    public List<OutStockDetailsVo> listByStockId(Long stockId) {
        return outStockDetailsMapper.listByStockId(stockId);
    }
}
